package cn.jly.spring.annotation.ioc.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author lanyangji
 * @description dog
 * @date 2020/11/12 下午 5:10
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Dog {
    private String name;

    /**
     * 对象创建并赋值之后调用
     */
    @PostConstruct
    public void init() {
        System.out.println("Dog.init 初始化");
        this.setName("tom");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("Dog.destroy 销毁");
    }
}
